package com.mixsmart.commonweb.bean.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.mixsmart.commonweb.bean.ICreateTime;
import com.mixsmart.commonweb.bean.IPKStringBean;
import com.mixsmart.core.IMixSmart;

/**
 * 角色实体
 * @author lmq
 * @version 1.0
 * @since JDK版本大于等于1.6
 * 2016年2月1日
 */
@Entity
@Table(name="t_c_role")
public class TCRole implements IPKStringBean, ICreateTime {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7952203140615464620L;

	private String id;
	
	private String name;
	
	private String userId;
	
	private String descr;
	
	private Integer state;
	
	private List<TCMenu> menus;
	
	private Date createTime;
	
	private String flag = IMixSmart.ROLE_GENERAL;

	public TCRole() {
	}

	public TCRole(String name, String descr, Integer state, String flag) {
		this.name = name;
		this.descr = descr;
		this.state = state;
		this.flag = flag;
	}

	public TCRole(String id, String name, String descr, Integer state, String flag) {
		this.id = id;
		this.name = name;
		this.descr = descr;
		this.state = state;
		this.flag = flag;
	}

	@Id
	@Column(name="id", length=50)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name="name", length=127, nullable=false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name="descr", length=500)
	public String getDescr() {
		return descr;
	}

	public void setDescr(String descr) {
		this.descr = descr;
	}

	@Column(name="state", length=2)
	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	@Transient
	public List<TCMenu> getMenus() {
		return menus;
	}

	public void setMenus(List<TCMenu> menus) {
		this.menus = menus;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="create_time",updatable=false)
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name="flag",length=50)
	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	@Column(name="user_id",length=50)
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	
}
